import request from '/@/utils/request';

/**
 *
 * 角色api接口集合
 */
export function roleApi() {
	return {
		getTableData: (data: object) => {
			return request({
				url: 'sysRole/page',
				method: 'post',
				data: data,
			});
		},
		addRecord: (role: object) => {
			return request({
				url: 'sysRole/add',
				method: 'post',
				data: role,
			});
		},
		updateRecord: (role: object) => {
			return request({
				url: 'sysRole/update',
				method: 'post',
				data: role,
			});
		},
		delRecord: (role: object) => {
			return request({
				url: 'sysRole/delete',
				method: 'post',
				data: role,
			});
		},
		roleList: () => {
			return request({
				url: 'sysRole/roleList',
				method: 'get',
			})
		},
		roleMenuList: (roleId: number) => {
			return request({
				url: 'sysRole/getRoleMenuList/' + roleId,
				method: 'get',
			})
		},
		assignMenus: (role: object) => {
			return request({
				url: 'sysRole/assignMenus',
				method: 'post',
				data: role,
			});
		}
	};
}
